<html>
<head><meta charset="utf-8"><title>LLVMContext::diagnose not triggering an error · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LLVMContext.3A.3Adiagnose.20not.20triggering.20an.20error.html">LLVMContext::diagnose not triggering an error</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="211653839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LLVMContext%3A%3Adiagnose%20not%20triggering%20an%20error/near/211653839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hugues de Valon <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LLVMContext.3A.3Adiagnose.20not.20triggering.20an.20error.html#211653839">(Sep 29 2020 at 17:19)</a>:</h4>
<p>Hello!</p>
<p>I am adding a LLVM feature in Rust and expecting the following lines to fail, because <code>diagnose</code> is called with a <code>DiagnosticInfoUnsupported</code> object which has a severity of <code>DS_Error</code>.</p>
<div class="codehilite"><pre><span></span><code>DiagnosticInfoUnsupported Diag(...)
DAG.getContext()-&gt;diagnose(Diag);
</code></pre></div>


<p>However while debugging I can see that the lines above are run but the compilation goes through without any error output.<br>
Would it be possible that Rust configures LLVM in some way that this diagnostic gets ignored?</p>
<p>The specific lines referenced are <a href="https://github.com/llvm/llvm-project/blob/67aac915ba94a75cbdb3c9c5f6c8e9904829ce37/llvm/lib/Target/ARM/ARMISelLowering.cpp#L4447">here</a> in LLVM.</p>



<a name="211655030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LLVMContext%3A%3Adiagnose%20not%20triggering%20an%20error/near/211655030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LLVMContext.3A.3Adiagnose.20not.20triggering.20an.20error.html#211655030">(Sep 29 2020 at 17:26)</a>:</h4>
<p>Maybe diagnostics need to be explicitly shown by the user of LLVM?</p>



<a name="211735234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LLVMContext%3A%3Adiagnose%20not%20triggering%20an%20error/near/211735234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hugues de Valon <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LLVMContext.3A.3Adiagnose.20not.20triggering.20an.20error.html#211735234">(Sep 30 2020 at 09:31)</a>:</h4>
<p>What do you mean? I though that [<code>diagnose</code>] would make the compiler exit directly at this call. As in <a href="https://llvm.org/doxygen/LLVMContext_8cpp_source.html#l00237">the code</a> is directly calling <code>exit</code>.</p>



<a name="211742620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LLVMContext%3A%3Adiagnose%20not%20triggering%20an%20error/near/211742620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hugues de Valon <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LLVMContext.3A.3Adiagnose.20not.20triggering.20an.20error.html#211742620">(Sep 30 2020 at 10:51)</a>:</h4>
<p>Ok I think I found out why. Rust is defining a <a href="https://github.com/rust-lang/rust/blob/12f667fac30c5d074a0e5c766222b5a7b6c88246/compiler/rustc_codegen_llvm/src/back/write.rs#L305"><code>diagnostic_handler</code></a> which is not handling the "info unsupported" diagnostic and hence ignoring it.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>